Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

Creating and Drawing Paths

A path contour is a series of connected points. The contour can contain both straight lines and curves. Therefore, the geometric points that make up a path contour can be on-curve points or off-curve control points. QuickDraw GX defines the gxPath structure to encapsulate a path contour geometry:

struct gxPath {
    long                vectors;
    long                controlBits[gxAnyNumber];
    struct gxPoint      vector[gxAnyNumber];
};

The vectors field indicates the number of geometric points in the path and the vector array contains the geometric points themselves. The controlBits array specifies which geometric points are on-curve points and which are off-curve control points. A value of 0 indicates an on-curve point and a value of 1 indicates an off-curve point. For example, a controlBits field with the value

0x55555555   /* 0101 0101 0101 0101 ... */

indicates that every other point is an off-curve control point; the first point is on curve, the second point is off, and so on. As another example, a controlBits field value of

0x00000000   /* 0000 0000 0000 0000 ... */

indicates all points are on curve, which effectively creates a polygon.

Notice that the controlBits array allows you to specify sequential off-curve control points. For example, a controlBits value of

0xFFFFFFFF   /* 1111 1111 1111 1111 ... */

indicates that all points are off curve. When you indicate that two control points in a row are off curve, QuickDraw GX assumes an on-curve point midway between them.

The path shape allows you to group any number of contours within a single QuickDraw GX shape. The gxPaths structure encapsulates the multiple-path geometry:

struct gxPaths {
    long             contours;
    struct gxPath    contour[gxAnyNumber];
};

The contours field indicates the total number of contours (in other words, the total number of separate paths), and the contour array contains the path geometries.

Creating Paths With a Single Contour

Creating Paths Using Only Off-Curve Points

Creating Paths With Multiple Contours


© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |